import { View, Button, Text, Image } from '@tarojs/components';
import Taro from '@tarojs/taro';
import React, { Component } from 'react';
import * as T from '../types';
import './doubleMenbership.less';
import actions from '../actions/index';
import { connect } from 'react-redux';
import { store2Props } from '../selectors';

import { AtCurtain } from 'taro-ui';
import 'taro-ui/dist/style/components/curtain.scss';
import joinMemberImage from '@/assets/image/index/joinMember.png';
import joinMemberTitleImage from '@/assets/image/index/joinMember_title.png';
import DoubleImg from '@/assets/image/index/doubleImg.png';
import Close from '@/assets/image/index/doubleCancle.png';
import { FSAgent } from 'miniprogram-ci/dist/@types/utils/fsagent';



interface ComponentState {
    doubleMemModel: boolean;
}

type ITopProps = T.IProps & T.ITopProps & ComponentState;
//@ts-ignore
@connect<Partial<ITopProps>, T.ITopState>(store2Props, actions)
export default class Info extends Component<Partial<ITopProps>, T.ITopState> {
    constructor(props: ITopProps) {
        super(props);
        this.state = {
            doubleMemModel: Taro.getStorageSync('doubleMemModel'),
        };
    }

    // async componentDidUpdate() {
    //     let itemStr = Taro.getStorageSync('b2b-wechat@login');
    //     if (itemStr) {
    //         console.log('双会员+++++++++++++++++++++++++++++++++++++++》》')
    //         // 现实双会员
    //         // this.getDoubleMembers();
    //     }
    // }

    render() {
        let {
            main: { doubleMemModel },
            actions: { action },
        } = this.props;
        return (
            // @ts-ignore
            <AtCurtain
                // @ts-ignore
                isOpened={doubleMemModel}
                // isOpened={this.state.doubleMemModel}
                onClose={() => {
                    // Taro.setStorageSync('doubleMemModel', false);
                    this.props.actions.action.commonChange('main.doubleMemModel', false);
                }}
            >
                <View className="double">
                    <Image className='double-img'  src={DoubleImg}
                    style={{width:'calc(100vw-20px)',height:'calc(100vw*2.6)'}}
                        onClick={() => {
                            // Taro.setStorageSync('doubleMemModel', false);
                            this.props.actions.action.commonChange('main.doubleMemModel', false);
                            Taro.navigateTo({ url: '/pages/package-A/complimentary/index' });
                        }}
                    />
                </View>
            </AtCurtain>
        );
    }
}


